feat: improve agent ergonomics with better tool descriptions#84
Open
bobbbino wants to merge 1 commit intoperplexityai:mainfrom
Open
feat: improve agent ergonomics with better tool descriptions#84bobbbino wants to merge 1 commit intoperplexityai:mainfrom
bobbbino wants to merge 1 commit intoperplexityai:mainfrom
Conversation
…mbiguation Rewrite tool descriptions to be action-first with clear use-case guidance, add server-level instructions, constrain role to enum, add idempotentHint, and improve output schema descriptions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The current tool descriptions for
perplexity_ask,perplexity_research, andperplexity_reasonare nearly identical ("Accepts an array of messages...and returns a response"), giving AI agents no basis for choosing between them. This PR rewrites descriptions and adds supporting metadata to make tool selection intuitive for agents.Changes
Server-level
instructions: Added aninstructionsfield to theMcpServerconstructor, giving agents a high-level overview of all tools and when to use each one. This is surfaced in the MCPinitializeresponse.Rewritten tool descriptions: All 4 tool descriptions now follow an action-first format with:
Constrained
roleparameter: Changedrolefromz.string()toz.enum(["system", "user", "assistant"])so agents see the valid values in the schema rather than guessing.Improved output schema descriptions: Made return shapes explicit (e.g., "AI-generated text response with numbered citation references" instead of "The response from Perplexity").
Added
idempotentHint: trueto all tool annotations: All 4 tools are read-only queries that can be safely retried without side effects.Why
When an agent receives a list of MCP tools, descriptions are the primary signal for tool selection. The previous descriptions were generic and duplicated across tools, forcing agents to guess or pick arbitrarily. These changes give agents clear disambiguation criteria, reducing misrouted calls and improving response quality — especially in multi-tool workflows where the agent needs to decide between a quick answer (
perplexity_ask), deep research (perplexity_research), or step-by-step reasoning (perplexity_reason).Test plan
npm run build— TypeScript compiles cleanlyroleparameter shows enum constraint in schemaidempotentHintappears in tool annotationsinstructionsappear in initialize response🤖 Generated with Claude Code